<%@page contentType="text/xml"%><?xml version="1.0" encoding="UTF-8"?>
<%@ page import="java.util.Collection, java.util.Iterator" %>
<%@ page import="chelydra.sharelydra.server.ejb.SLSUser, chelydra.sharelydra.server.ejb.SLSNotification" %>
<% SLSUser user = (SLSUser)request.getAttribute("user"); %>
<sharelydra type="success">

    <!-- PROFILE -->
    <profile>
        <email><%= user.getEmail()%></email>
		<firstName><%= user.getFirstName()%></firstName>
		<lastName><%= user.getLastName()%></lastName>
		<ip><%= user.getIp()%></ip>
		<login><%= user.getLogin()%></login>
		<nickname><%= user.getNickname()%></nickname>
		<port><%= user.getPort()%></port>
        <hideInSearch><% out.print((user.getHideInSearch()>0)?"true":"false"); %></hideInSearch>
        <hideEmail><% out.print((user.hidesEmail())?"true":"false"); %></hideEmail>
	</profile>

    <!-- ACTION -->
    <% String actionName = (String)request.getAttribute("action_name"); %>
    <action>
        <name><%= actionName %></name>
    <%
    if (actionName.contentEquals("search")) {
    %><%@include file="_search.jspf" %><%
    }
    %>
    </action>

    <!-- FRIENDS -->
	<%
        Iterator i = null;
        Collection<SLSUser> friends = (Collection)request.getAttribute("friends");
        if (!friends.isEmpty()) {
    %>
    <friends>
    <%
            i = friends.iterator();
            while (i.hasNext()) {
                request.setAttribute("friend", i.next());
    %>
        <%@include file="_friend.jspf" %>
    <%}/*while*/%>
	</friends>
	<%}/*if*/%>

    <!-- NOTIFICATIONS -->
	<%
		Collection<SLSNotification> notes = (Collection)request.getAttribute("notifications");
		if (!notes.isEmpty()) {
	%>
    <notifications>
	<%
            i = notes.iterator();
            while (i.hasNext()) {
				request.setAttribute("notification", i.next());
	%>
		<%@include file="_notification.jspf" %>
	<%}/*while*/%>
	</notifications>
	<%}/*if*/%>
</sharelydra>
